package testString_Buffer_Builder.builderVsBuffer;

public class BuilderVsBuffer {

	public static void main(String[] args) {

		StringBuffer sbuffer = new StringBuffer();

		long inicio = System.currentTimeMillis();        
		for (int i=0; i<1_000_000; i++) {             
			sbuffer.append("hola ");			     
		}
		long fin = System.currentTimeMillis();        

		System.out.println("Tiempo del StringBuffer: " + (fin-inicio));        

		
		StringBuilder sbuilder = new StringBuilder();        

		inicio = System.currentTimeMillis();        
		for (int i=0; i<1_000_000; i++) {             
			sbuffer.append("hola ");
		}
		fin = System.currentTimeMillis();        

		System.out.println("Tiempo del StringBuilder: " + (fin-inicio));
	}

}
